<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/5/7 0007
 * Time: 下午 1:54
 */

namespace app\sports_admin\vaildate;


class Equipment extends Base
{
    protected $rule = [
        'id'=>'require|isPositiveInteger',
    ];

    protected $message = [
        'id'=>'编号必须为整数',
    ];
    //添加验证
    public function insert()
    {
        $rule = [
            'number'=>'require|length:15',
            'serial_number'=>'require|integer',
            'device_batch'=>'require|integer'
        ];
        $msg = [
            'number'=>'设备编号由15位组成',
            'serial_number'=>'座位号必须是整数',
            'device_batch'=>'批次号必须是整数',
        ];
        self::goCheck($rule,$msg);
    }
    //绑定验证
    public function binding()
    {
        $rule = [
            'id'=>'require',
            'bindings'=>'require|integer',
            'info'=>'require'
        ];
        $msg = [
            'id'=>'请选择设备',
            'bindings'=>'请选择绑定类型',
            'info'=>'请输入绑定对象',
        ];
        self::goCheck($rule,$msg);
    }
    //解绑操作
    public function untying()
    {
        $rule = [
            'id'=>'require',
            'bindings'=>'require|integer',
        ];
        $msg = [
            'id'=>'请选择设备',
            'bindings'=>'请选择绑定类型',
        ];
        self::goCheck($rule,$msg);
    }
    //修改设备信息操作
    public function update()
    {
        $rule = [
            'id'=>'require|integer',
            'serial_number'=>'require|integer',
           // 'batch'=>'require|integer'
        ];
        $msg = [
            'id'=>'请选择设备',
            'serial_number'=>'座位号格式错误',
           // 'batch'=>'批次号格式错误'
        ];
        self::goCheck($rule,$msg);
    }
    //下发编号
    public function lowerNumber()
    {
        $rule = [
            'batch'=>'require|integer'

        ];
        $msg = [
            'batch'=>'请输入批次号'
        ];
        self::goCheck($rule,$msg);
    }
}